public class Course {
    private String courseId;
    private String courseName;
    private int credits;

    public Course(String courseId, String courseName, int credits) {
        this.courseId = courseId;
        this.courseName = courseName;
        this.credits = credits;
    }

    public Course() {
    }

    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public int getCredits() {
        return credits;
    }

    public boolean setCredits(int credits) {
        if(credits < 0 || credits > 6){
            System.out.println("学分只能在1到6之间。");
            return false;
        }

        this.credits = credits;
        System.out.println("测试");
        return true;
    }

    @Override
    public String toString() {
        return "课程编号：" + courseId + ",课程名称：" + courseName + ",课程学分：" +  credits;
    }
}
